<?php
class Performance extends AppModel
{
    var $useTable = false;

    //const PARAMETER_ARRIVAL = 0;
    //const PARAMETER_ACTIVE_TIME = 1;
    //
    //public $parameter = array(
    //    0 => 'arrival',
    //    1 => 'active time'
    //);

    public function getArrivalData($user_id, $year, $month)
    {
        $cWorklog = ClassRegistry::init('Worklog');
        $cWorklog->recursive = -1;
        $worklogs = $cWorklog->find('all',
            array(
                'fields' => array(
                    'DAY(start) day',
                    'HOUR(start) hour',
                    'MINUTE(start) minute'
                ),
                'conditions' => array(
                    'YEAR(start)' => $year,
                    'MONTH(start)' => $month,
                    'user_id' => $user_id
                )
            )
        );

        $data = array();
        foreach($worklogs as $w) {
            $data[$w[0]['day']] = $w[0];
        }
        return $data;
    }
}
?>
